package com.ysh.dbpool;

import java.sql.Connection;

/**
 * @author yangshuo
 */
public class MyConnection implements java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4074481758082416415L;

	/**
	 * DB connection wrapped
	 */
	private Connection con;

	/**
	 * The last time when the connection is released
	 * 
	 * @uml.property name="lastReleasedTime"
	 */
	private long lastReleasedTime;

	/**
	 * Create a MyConnection
	 * 
	 * @param con:Connection wrapped
	 */
	public MyConnection(Connection con) {
		this.con = con;
		this.lastReleasedTime = System.currentTimeMillis();
	}

	/**
	 * Get connection wrapped
	 * 
	 * @return Connection
	 */
	public Connection getConnection() {
		return this.con;
	}

	/**
	 * Set the last time when connection is released
	 * 
	 * @param lastReleasedTime:last time
	 * @uml.property name="lastReleasedTime"
	 */
	public void setLastReleasedTime(long lastReleasedTime) {
		this.lastReleasedTime = lastReleasedTime;
	}

	/**
	 * Get the last time when connection is released
	 * 
	 * @return long
	 * @uml.property name="lastReleasedTime"
	 */
	public long getLastReleasedTime() {
		return this.lastReleasedTime;
	}

	/**
	 * Set the connection to wrapp
	 * 
	 * @param con:connection wrapped
	 */
	void setConnection(Connection con) {
		this.con = con;
	}

}
